<template>
  <view class="content ft36 dlc-bg">
    <view class="dlc-bg-primary top-box pdb30">
      <view class="tlt ft60 pd50-y">余额</view>
      <view class="number ft50">{{(myWallet.amount+myWallet.givenAmount)/100}}元</view>
      <view class="tlt ft30 pd30-y"></view>
      
   
	  <button class="btn"  @tap="toUserRecharge">
        充值
	  </button> 
    </view> 
    <view @tap="toRechargeList" class="bot-text">
      <text>财务列表</text>
    </view>
  </view>
</template>

<script>
import store from '@/store';
import {getAmount} from "@/api"
export default {
  data () {
    return {
      myWallet:{}
    }
  },
  methods: {
    toUserRecharge(){
      uni.switchTab({
        url: '/pages/userRecharge/index'
      });
    },
    toRechargeList(){
      uni.navigateTo({
         url: `/pagesA/userRecharge/rechargeList`
      })
    },
     //调用服务器接口 查询钱包
    async getWallet(){
      const { data } = await getAmount()
      this.myWallet = data.data
    },
  },
  onLoad(){
    this.type = this.$root.$mp.query.type
    if(this.type == 1){
      this.visible2 = true
    }
    if(this.$root.$mp.query.number){
      this.number = this.$root.$mp.query.number
    }
    this.getWallet()
  },
  onShow() {
    this.getWallet()
  },
  computed: {
    userInfo () {
      return store.state.user.userInfo
    }
  }
}
</script>
<style lang="stylus" scoped>
.content {
  text-align: center;
  width: 100%;
  height: 100vh;
}
.btn {
  width: 300rpx !important;
  height:80rpx
  color: #3e87f0 !important;
  border-radius: 22rpx !important;
  background-color: #fff !important;
  font-size: 42rpx;
  line-height 80rpx;
  margin-top : 50rpx;
  z-index:999
}
.top-box {
  color: #fff;
  background-color:#3e87f0;
  height: 40vh;
}
.icon {
  display: inline;
}
.bot-text{
  height :45rpx
  width :100%
  font-size :30rpx
  color:#087ffd;
  position:fixed;
  bottom:20rpx;
  text-align:center;
  
}
</style>